<template>
	<view class="paymentDetail">
		<view class="paymentDetailIcon">
			<icon class="icon-small" type="success_circle" color="#006eff" size="50"></icon>
			<text>缴费成功</text>
		</view>
		<confirmlnfoDetail :list="Data.list"></confirmlnfoDetail>
		<confirmlnfoBreakdown></confirmlnfoBreakdown>
		<confirmlnfoDetail :list="Data.payList"></confirmlnfoDetail>
	</view>
</template>

<script setup>
	import confirmlnfoDetail from '@/pages/selfPayment/confirmInfo/confirmlnfoDetail.vue'
	import confirmlnfoBreakdown from '@/pages/selfPayment/confirmInfo/confirmlnfoBreakdown.vue'
	import {
		reactive
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		selfpayPaylist
	} from '@/api/TopUpService.js'
	const Data = reactive({
		list: [{
				key: '费用类型',
				value: '西药费'
			},
			{
				key: '就诊科室',
				value: '消化内科'
			},
			{
				key: '医生姓名',
				value: '李梅'
			},
			{
				key: '就 诊 人',
				value: '牛韦'
			},
			{
				key: '就诊卡号',
				value: '610*********0989'
			}
		],
		payList: [{
				key: '支付方式',
				value: '余额'
			},
			{
				key: '卡内余额',
				value: '1400.00元'
			},
			{
				key: '订单总额',
				value: '600.00元',
				color: '#f46464'
			},
			{
				key: '订单编号',
				value: '202010090900001'
			},
			{
				key: '订单时间',
				value: '2020/10/09 09:00:00'
			},
			{
				key: '订单状态',
				value: '已支付'
			}
		]
	})
	const selfpaylist = (id) => {
		selfpayPaylist({
			orderId: id
		}).then(({
			data
		}) => {
			if (data.msg == 'success') {
				switch (data.data[0].expenseType) {
					case 0:
						data.data[0].expenseType = "门诊费";
						break;
					case 1:
						data.data[0].expenseType = "西药费";
						break;
					case 2:
						data.data[0].expenseType = "中药费";
						break;
				}
				Data.list[0].value = data.data[0].expenseType;
				Data.list[1].value = data.data[0].departmentName;
				Data.list[2].value = data.data[0].doctorName;
				Data.list[3].value = data.data[0].patientName;
				Data.list[4].value = data.data[0].visitNum;
				Data.payList[1].value = data.data[0].cardBalance + '.00元';
				Data.payList[2].value = data.data[0].orderTotal + '.00元';
				Data.payList[3].value = data.data[0].orderId;
				Data.payList[4].value = data.data[0].payTime;
			}
		}).catch(err => {
			console.log(err)
		})
	}
	onLoad((options) => {
		options.orderId && (selfpaylist(options.orderId));
	})
</script>

<style lang="less" scoped>
	.paymentDetail {
		width: 750rpx;
		height: 100%;
		background-color: #fdfeff;

		.paymentDetailIcon {
			width: 100%;
			height: 250rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			text {
				margin-top: 20rpx;
				font-size: 35rpx;
				font-weight: 600;
				color: #333333;
			}
		}
	}
</style>
